/*
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

//******************************************************************************
//* Function Name : bsp_prv_software_delay_loop
//* Description   : This assembly language routine takes roughly 4 cycles per loop. 2 additional cycles
//*                 occur when the loop exits. The 'naked' attribute  indicates that the specified function does not need
//*                 prologue/epilogue sequences generated by the compiler.
//* @param[in]      loop_cnt  The number of loops to iterate.
//******************************************************************************
    .global bsp_prv_software_delay_loop
    .type   bsp_prv_software_delay_loop,%function
    .func   bsp_prv_software_delay_loop
bsp_prv_software_delay_loop:
sw_delay_loop:
    sub x0, x0, #1      ///< 1 cycle
    cmp x0, #0          ///< 1 cycle
    b.ne sw_delay_loop  ///< 2 cycles
    RET                 ///< 2 cycles
    .endfunc

    .END
